// ignore: camel_case_types
// ignore_for_file: constant_identifier_names

import 'dart:typed_data';

import 'package:flutter/services.dart';

class assets {
  static const String _basePath = 'assets/images/';

  static String getImagePath(String imageName) {
    return '$_basePath$imageName.png';
  }

  // 定义具体的图片资源
  static const String select_blue = '$_basePath勾.png';
  static const String line = '$_basePath横线.png';
  static const String arrow = '${_basePath}arrow.png';
  static const String upload_select = '${_basePath}upload_select.png';
  static const String upload = '${_basePath}upload.png';
  static const String refresh = '$_basePath刷新.png';
  static const String connect_select = '${_basePath}Connect_select.png';
  static const String connect_unselect = '${_basePath}Connect_unselect.png';
  static const String Logo = '${_basePath}Logo.png';
  static const String update_select = '${_basePath}Update_select.png';
  static const String update_unselect = '${_basePath}Update_unselect.png';
  static const String version_select = '${_basePath}version_select.png';
  static const String version = '${_basePath}version.png';

  ///读取本地文件
  static Future<Uint8List?> readBinFile(String fileName) async {
    try {
      // 读取 bin 文件
      ByteData data = await rootBundle.load('assets/$fileName');

      // 将 ByteData 转换为 Uint8List 并返回
      return data.buffer.asUint8List();
    } catch (e) {
      print('Error reading bin file: $e');
      return null;
    }
  }
}
